<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>

<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
<link href="CSS/adminstyle.css" rel="stylesheet" type="text/css" />
<script src="http://localhost:8080/travel/js/jquery.min.js"></script>
<script src="js/echarts.js"></script>
<style type="text/css">
#setinfodiv {
  height: 567px; 
  width:1100px;
  overflow-y:scroll;  /*纵向滚动条始终显示 */
  overflow-x:none;
 } 
 table {
  width: 1083px;   /*表格宽度＝div宽度(500px)－滚动条宽度(16px) */
 }
thead tr {
 position: relative;  TOP:0px;  /*绝对定位 */
 background:#cccccc;
}

tr {
 background:#cccccc;
}
.black_overlay{ 
display: none; 
position: absolute; 
top: 0%; 
left: 0%; 
width: 100%; 
height: 100%; 
background-color: black; 
z-index:1001; 
-moz-opacity: 0.8; 
opacity:.80; 
filter: alpha(opacity=88); 
} 
.white_content{ 
display: none; 
position: absolute; 
top: 25%; 
left: 25%; 
width: 55%; 
height: 55%; 
padding: 20px; 
border: 10px solid orange; 
background-color: white; 
z-index:1002; 
overflow: auto; 
} 

       
</style>
<script type="text/javascript">
function setmoneybyseller(){
$.getJSON("SellerServlet",{flag:"getmoneypojo",userid:${sessionScope.seller.seller_id}},function(data){
		var mydiv=document.getElementById("setinfodiv");
		var myecharts=echarts.init(mydiv);
		var myoption={
		title:{text:"上半年营业额"},
		tooltip:{show:true,trigger:"axis",axisPointer:{type:"cross"}},
		toolbox:[{show:true,feature:{
			saveAsImage:{},
			restore:{},
			magicType:{type:["line","bar"]},
			dataView:{readOnly :false}
		}}],
		legend:[{data:[{name:"上半年营业额",icon:"circle"}]}],
		xAxis:{type:"category",name:"月份",data:["一月","二月","三月","四月","五月","六月"]},
		yAxis:{name:"金额"},
		series:[{name:"上半年营业额",
				type:"line",
				 data:[data.Jan,data.Fed,data.Mar,data.Apr,data.May,data.Jun]
		}]
		};
		myecharts.setOption(myoption);
	});
    }
</script>
<script>
	function getwhattodo(op) {
		if (op == "信息查询") {
			var str = "<form  action='SellerServlet?flag=updateinfo&sellerid="+${sessionScope.seller.seller_id}+"' method='post'> <table cellpadding='10px'style='width:100%;'>" +
				"<thead class='fixedThead'>" +
				"<tr><th>商家ID</th><th>名字</th><th>地址</th><th>电话</th><th>简介</td></thead>" +
				"<tbody class='scrollTbody' ";

			str = str + "<tr><td>${sessionScope.seller.seller_id}</td><td><input  name='sname' type='text' value='${sessionScope.seller.seller_name}'/> " +
				"</td><td><input name='saddr' type='text' value='${sessionScope.seller.seller_addr}'/></td><td><input  name='stel' type='text' value='${sessionScope.seller.seller_tel}'/></td><td>" +
				"<textarea name='ssy'  rows='8' cols='40' >"+'${sessionScope.seller.seller_synopsis}'
				+"</textarea ></td></tr>";
			str = str + "<tr><td></td><td></td><td></td><td></td><td align='right'><input type='submit' value='确认修改' ></td></tr> </tbody></table> </form>";

			//document.getElementById("setwhattodo").innerHTML = op;
			$("#setwhattodo").html(op);
			//document.getElementById("setinfodiv").innerHTML = str;
             $("#setinfodiv").html(str);

		} else if(op=="修改密码"){
		
		var str="<form action='SellerServlet?flag=updatepwd&sellerid="+${sessionScope.seller.seller_id}+"' method='post'><br/>初始密码<input id='oldpwd' name='oldpwd' class='labstyle' type='password'  onblur='checkpwd1()'><br/><br/>"+
		      "新密码 &nbsp&nbsp&nbsp<input id='newpwd' name='newpwd'  class='labstyle'  type='password'  onblur='checkpwd2()'><br/><br/>"+
		     "确认密码<input id='newpwd1' name='newpwd1' type='password'  class='labstyle' onblur='checkpwd()'><br/><br/>"+
		     "&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp<input type='submit' onclick='return update()' value='确认修改'></form>";
		
		    document.getElementById("setwhattodo").innerHTML = op;
			document.getElementById("setinfodiv").innerHTML = str;
		}else if(op=="所有房间"){
		
		var str="<table cellpadding='10px'style='width:100%;'>" +
		        "<thead class='fixedThead'>" +
		        "<tr><th>房间ID</th><th>房间类型</th><th>价格</th><th>状态</th><th>删除</th></tr></thead>" +
				"<tbody class='scrollTbody'>";
	$.getJSON("SellerServlet",{flag:"queryroom",sellerid:${sessionScope.seller.seller_id}},function(data){
		
				for(var i=0;i<data.length;i++){
				str=str+"<tr><td>"+data[i].room_id+"</td><td>"+data[i].room_type+"</td>"+
		    	"<td>"+data[i].room_money+"</td><td>"+data[i].room_system+"</td><td><a href='RoomServlet?flag=delete&roomid="+data[i].room_id+"'><input type='button' value='删除'/></a></td></tr>";
		   		 }
			str=str+"</tbody></table>";
		    document.getElementById("setwhattodo").innerHTML = op;
			document.getElementById("setinfodiv").innerHTML = str;	
		}); 
		
	
		
		}   else if(op=="添加房间"){
			var str = "<form  action='RoomServlet?flag=addroom&sellerid="+${sessionScope.seller.seller_id}+"' method='post'> <table cellpadding='10px'style='width:100%;'>" +
			"<thead class='fixedThead'>"+
			"<tr><td><th>房间类型</th></td><td><input type='text' name='rtype'/></td></tr>"+
			"<tr><td><th>房间价格</th></td><td><input type='text' name='rmoney'/></td></tr>"+
			"<tr><td><th>房间图片</th></td><td><input type='file' name='mylogo'/></td></tr></thead>"+
			"<tbody class='scrollTbody'>";
		    str = str + "<tr><td></td><td></td><td><input type='submit' value='确认添加' ></td></tr></tbody> </form>";	
			 document.getElementById("setwhattodo").innerHTML = op;
		     document.getElementById("setinfodiv").innerHTML = str;
		    
		}else if(op=="所有订单"){
		var str="<table cellpadding='10px'style='width:100%;'>" +
		        "<thead class='fixedThead'>" +
		        "<tr><th>订单ID</th><th>用户名</th><th>下单时间</th><th>预定天数</th><th>金额</th><th>房间类型</th><th>状态</th><th>离店时间</th><th>完成订单</th><th>失效订单</th></tr></thead>" +
				"<tbody class='scrollTbody'>";
	$.getJSON("OrderServlet",{flag:"order",sellerid:${sessionScope.seller.seller_id}},function(data){
		
				for(var i=0;i<data.length;i++){
				str=str+"<tr><td>"+data[i].order_id+"</td><td>"+data[i].order_user.user_name+"</td>"+
		    	"<td>"+data[i].order_time+"</td><td>"+data[i].order_days+"</td><td>"+data[i].order_money+"</td><td>"+
		    	data[i].order_room.room_type+"</td><td>"+
		    	data[i].order_state+"</td><td>"+
		    	data[i].order_endtime+"</td><td><a href='OrderServlet?flag=update&state="+"已完成"+"&orderid="+
		    	data[i].order_id+"'><input type='button' value='完成订单'/></a></td><td><a href='OrderServlet?flag=update&state="+"已失效"+"&orderid="+
		    	data[i].order_id+"'><input type='button' value='失效订单'/></a></td></tr>";
		   		 }
			str=str+"</tbody></table>";
		    document.getElementById("setwhattodo").innerHTML = op;
			document.getElementById("setinfodiv").innerHTML = str;	
		}); 
		
		}
           
    
	}
</script>


<script>


	function checkpwd() {
		var a = $("#newpwd").val();
		var b = $("#newpwd1").val();
		if (a != b) {
			$("#checkpwdlab").html("<font color='red' size='2'>×两次密码不相同</font>");
			return false;
		} else {
			$("#checkpwdlab").html(" ");
			return true;
		}
	}
	function checkpwd1() {
		var a = $("#newpwd").val();
		if (a == null || a == "") {
			return false;
		} else {
			return true;
		}
	}
	function checkpwd2() {
		var a = $("#oldpwd").val();
		if (a == null || a == "") {
			return false;
		} else {
			return true;
		}
	}
	function update() {
		return checkpwd() && checkpwd1() && checkpwd2();
	}
</script>
</head>

<body>
	<div class="header">
		<div class="header03"></div>
		<div class="header01"></div>
		<div class="header02">酒店后台管理系统</div>
	</div>
	<div class="left" id="LeftBox">
		<div class="left01">
			<div class="left01_right"></div>
			<div class="left01_left"></div>
			<div class="left01_c">店名：${seller.seller_name}</div>
		</div>
		<div class="left02">
			<div class="left02top">
				<div class="left02top_right"></div>
				<div class="left02top_left"></div>
				<div class="left02top_c">商家信息管理</div>
			</div>

			<div class="left02down">
				<div class="left02down01">
					<a href="javascript:;" onclick="getwhattodo('信息查询')">
						<div id="Bf080" class="left02down01_img"></div>信息查询
					</a>
				</div>


				<div class="left02down01">
					<a href="javascript:;" onclick="getwhattodo	('修改密码')">
						<div id="Bf081" class="left02down01_img"></div> 修改密码
					</a>
				</div>

			</div>
		</div>
		<div class="left02">
			<div class="left02top">
				<div class="left02top_right"></div>
				<div class="left02top_left"></div>
				<div class="left02top_c">酒店住房管理</div>
			</div>
			<div class="left02down">
				<div class="left02down01">
					<a href="javascript:;" onclick="getwhattodo('所有房间')">
						<div id="Bf082" class="left02down01_img"></div>所有房间
					</a>
				</div>
				<div class="left02down01">
					<a href="#" onclick="getwhattodo('添加房间')">
						<div class="left02down01_img"></div>添加房间
					</a>
				</div>



			</div>
		</div>

		<div class="left02">
			<div class="left02top">
				<div class="left02top_right"></div>
				<div class="left02top_left"></div>
				<div class="left02top_c">订单管理</div>
			</div>
			<div class="left02down">
				<div class="left02down01">
					<a href="#" onclick="getwhattodo('所有订单')">所有订单</a>
				</div>


			</div>
		</div>
		<div class="left02">
			<div class="left02top">
				<div class="left02top_right"></div>
				<div class="left02top_left"></div>
				<div class="left02top_c">财务报表</div>
			</div>
			<div class="left02down">
				<div class="left02down01">
					<a href="#" onclick='setmoneybyseller()'>财务报表</a>
				</div>


			</div>
		</div>
		<div class="left01">
			<div class="left03_right"></div>
			<div class="left01_left"></div>
			<div class="left03_c">
				<a href="index.jsp">安全退出</a>
			</div>
		</div>
	</div>
	<div class="rrcc" id="RightBox">
		<div class="center" id="Mobile" onclick="show_menuC()"></div>
		<div class="right" id="li010">
			<div class="right01">
				<img src="image/admin/04.gif" /> <label id="setwhattodo">菜单栏</label>
				<div id="setinfodiv" style="width:1000px; heigh:550px;"></div>



				<div id="mydiv" style="width:1000px; heigh:1000px;"></div>








			</div>
		</div>

	</div>








</body>
</html>
